package org.apache.servicecomb.samples.practise.houserush.gateway;

import org.apache.servicecomb.common.rest.codec.RestObjectMapperFactory;
import org.apache.servicecomb.springboot.starter.provider.EnableServiceComb;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.text.SimpleDateFormat;
import java.util.TimeZone;

/**
 * @Author: Snake Man
 * @system: 网关
 * @DateTime: 2022/1/8 20:18
 * @Description:
 */

@SpringBootApplication
@EnableServiceComb
public class EdgeServiceApplication {

    public static void main(String[] args) {
        configBeforeBoot();
        SpringApplication.run(EdgeServiceApplication.class,args);
    }
    /**
     * 全局设置（引导类）
     */
    private static void configBeforeBoot(){
        //设置时间格式
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //设置时区
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("Asia/shanghai"));
        //输入转换器
        RestObjectMapperFactory.getConsumerWriterMapper().setDateFormat(simpleDateFormat);
    }
}
